import React from 'react';
import { Input, Select, DatePicker } from 'antd';
import moment from 'moment';
import { Querier } from '@/components';
import enums from '@/enums';
import { useProvinceOptions } from './hooks';

/**
 * 列表查询（验收列表）
 */
function AcceptanceListQuery(props) {
    const { form, onQuery } = props;

    const provinceOptions = useProvinceOptions();

    return (
        <Querier
            form={form}
            items={[
                {
                    label: '验收资料名称',
                    name: 'name',
                    initialValue: '',
                    children: <Input allowClear placeholder="请输入" />,
                },
                {
                    label: '省分',
                    name: 'provinceCode',
                    initialValue: undefined,
                    children: (
                        <Select
                            allowClear
                            showSearch
                            optionFilterProp="label"
                            loading={provinceOptions.loading}
                            options={provinceOptions.data}
                            placeholder="请选择"
                        />
                    ),
                },
                {
                    label: '状态',
                    name: 'acceptanceStatus',
                    initialValue: undefined,
                    children: (
                        <Select
                            allowClear
                            showSearch
                            optionFilterProp="label"
                            options={enums.ossAcceptance.acceptanceStatus.options()}
                            placeholder="请选择"
                        />
                    ),
                },
                {
                    label: '创建时间',
                    name: 'createTime',
                    initialValue: null,
                    children: (
                        <DatePicker.RangePicker
                            style={{ height: 32 }}
                            disabledDate={(current) => current > moment().endOf('day')}
                        />
                    ),
                },
            ]}
            onQuery={onQuery}
        />
    );
}

export default AcceptanceListQuery;
